Visualizing receptive Fields for Columns in Wall Street

In this notebook we visualize how the receptive fields of the Wall Street problem look when we use mixing in time. That is, when we allow the receptive field formation to actually cluster across time units in the inputs


In [1]:
# First we load the file 
file_location = '../results_database/text_wall_street_columns.hdf5'
run_name = '/test'
f = h5py.File(file_location, 'r')


# Now we need to get the letters and align them
text_directory = '../data/wall_street_letters.npy'
letters_sequence = np.load(text_directory)
Nletters = len(letters_sequence)
symbols = set(letters_sequence)

# Nexa parameters
Nspatial_clusters = 3
Ntime_clusters = 3
Nembedding = 3

parameters_string = '/' + str(Nspatial_clusters)
parameters_string += '-' + str(Ntime_clusters)
parameters_string += '-' + str(Nembedding)

nexa = f[run_name + parameters_string]
cluster_to_index = nexa['cluster_to_index']

matrix = np.zeros((10, 3))

for cluster in cluster_to_index:
    
    cluster_indexes = cluster_to_index[str(cluster)]

    for index in cluster_indexes:
        first_index = index // 3
        second_index = index % 3
        matrix[first_index, second_index] = cluster

import matplotlib.pyplot as plt
%matplotlib inline

plt.matshow(matrix)


Out[1]:
<matplotlib.image.AxesImage at 0x7f4dc959a978>

In [2]:
# First we load the file 
file_location = '../results_database/text_wall_street_columns.hdf5'
run_name = '/independent'
f = h5py.File(file_location, 'r')


# Now we need to get the letters and align them
text_directory = '../data/wall_street_letters.npy'
letters_sequence = np.load(text_directory)
Nletters = len(letters_sequence)
symbols = set(letters_sequence)

# Nexa parameters
Nspatial_clusters = 3
Ntime_clusters = 3
Nembedding = 3

parameters_string = '/' + str(Nspatial_clusters)
parameters_string += '-' + str(Ntime_clusters)
parameters_string += '-' + str(Nembedding)

nexa = f[run_name + parameters_string]
cluster_to_index = nexa['cluster_to_index']

matrix = np.zeros((10, 3))

for cluster in cluster_to_index:
    
    cluster_indexes = cluster_to_index[str(cluster)]

    for index in cluster_indexes:
        first_index = index // 3
        second_index = index % 3
        matrix[first_index, second_index] = cluster

import matplotlib.pyplot as plt
%matplotlib inline

plt.matshow(matrix)


Out[2]:
<matplotlib.image.AxesImage at 0x7f4dc95719e8>